import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { BaseinfoContractApi } from '#/api/csyt/baseinfocontract';

import { z } from '#/adapter/form';
import {
    getDictOptions,
    getRangePickerDefaultProps,
} from '#/utils';

/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'id',
      component: 'Input',
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'chatId',
      label: '会话Id',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话编号',
      },
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'chatName',
      label: '会话标题',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话标题',
        readOnly:true
      },
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'chatNo',
      label: '会话编号',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话编号',
        readOnly:true
      },
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'productCompany',
      label: '供方企业',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话编号',
        readOnly:true
      },
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'demandCompany',
      label: '需方企业',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话编号',
        readOnly:true
      },
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'contractHead',
      label: '合同标题',
      component: 'Input',
      componentProps: {
        placeholder: '请输入合同标题',
      },
    },
    {
      fieldName: 'contractResume',
      label: '合同摘要',
      component: 'Input',
      componentProps: {
        placeholder: '请输入合同摘要',
      },
    },
    {
      fieldName: 'tempFile',
      label: '合同模板',
      component: 'FileUpload',
    },
    // {
    //   fieldName: 'status',
    //   label: '状态',
    //   component: 'RadioGroup',
    //   componentProps: {
    //     options: [],
    //     buttonStyle: 'solid',
    //     optionType: 'button',
    //   },
    // }
  ];
}
export function useFormChat(): VbenFormSchema[] {
  return [
    // {
    //   fieldName: 'chatId',
    //   label: '会话Id',
    //   component: 'Input',
    //   componentProps: {
    //     placeholder: '请输入会话编号',
    //   },
    // },
    {
      fieldName: 'chatName',
      label: '会话标题',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话标题',
        readOnly:true
      },
    },
    {
      fieldName: 'chatNo',
      label: '会话编号',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话编号',
        readOnly:true
      },
    },
    {
      fieldName: 'productCompany',
      label: '供方企业',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话编号',
        readOnly:true
      }
    },
    {
      fieldName: 'demandCompany',
      label: '需方企业',
      component: 'Input',
      componentProps: {
        placeholder: '请输入需方企业',
        readOnly:true
      }
    },
  ];
}

export function useFormProduct(): VbenFormSchema[] {
  return [
    {
      fieldName: 'productNo',
      label: '产品编号',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话标题',
        readOnly:true
      },
    },
    {
      fieldName: 'productName',
      label: '产品名称',
      component: 'Input',
      componentProps: {
        placeholder: '请输入会话编号',
        readOnly:true
      },
    },

  ];
}
export function xuqiu(): VbenFormSchema[] {
  return [
    {
      fieldName: 'demandNo',
      label: '需求编号',
      component: 'Input',
      componentProps: {
        placeholder: '请输入需求编号',
        readOnly:true
      },
    },
    {
      fieldName: 'demandName',
      label: '需求名称',
      component: 'Input',
      componentProps: {
        placeholder: '请输入需求名称',
        readOnly:true
      },
    },

  ];
}
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    // {
    //   fieldName: 'chatNo',
    //   label: '会话编号',
    //   component: 'Input',
    //   componentProps: {
    //     allowClear: true,
    //     placeholder: '请输入会话编号',
    //   },
    // },
    {
      fieldName: 'chatName',
      label: '会话主题',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入会话主题',
      },
    },
    {
      fieldName: 'contractHead',
      label: '合同标题',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入合同标题',
      },
    },
    {
      fieldName: 'contractResume',
      label: '合同摘要',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入合同摘要',
      },
    },
    {
      fieldName: 'status',
      label: '状态',
      component: 'Select',
      componentProps: {
        allowClear: true,
        options: [],
        placeholder: '请选择状态',
      },
    },
    {
      fieldName: 'createTime',
      label: '创建时间',
      component: 'RangePicker',
      componentProps: {
        ...getRangePickerDefaultProps(),
        allowClear: true,
      },
    },
  ];
}

/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<BaseinfoContractApi.BaseinfoContract>['columns'] {
  return [
  { type: 'checkbox', width: 40 },
    {
      field: 'id',
      title: '序号',
      minWidth: 120,
    },
    {
      field: 'chatNo',
      title: '会话编号',
      minWidth: 120,
    },
    {
      field: 'chatName',
      title: '会话主题',
      minWidth: 120,
    },
    {
      field: 'contractHead',
      title: '合同标题',
      minWidth: 120,
    },
    {
      field: 'contractResume',
      title: '合同摘要',
      minWidth: 120,
    },
    {
      field: 'tempFile',
      title: '合同模板',
      minWidth: 120,
    },
    // {
    //   field: 'status',
    //   title: '状态',
    //   minWidth: 120,
    // },
    // {
    //   field: 'flag',
    //   title: '1新增2更新3删除',
    //   minWidth: 120,
    // },
    {
      field: 'createTime',
      title: '创建时间',
      minWidth: 120,
      formatter: 'formatDateTime',
    },
    {
      title: '操作',
      width: 200,
      fixed: 'right',
      slots: { default: 'actions' },
    },
  ];
}

